Re: [PATCH v1] man/man2/quotactl.2: tfix

Jan Kara <[email protected]>
Newsgroups org.kernel.vger.linux-man
Message-ID <b2kszapero3mb6q3763rrgjjfltkvt7aapm6s7oakpbpepfypk@mwybch7ayyqd>
Hi Alejandro!

On Mon 18-05-26 14:51:45, Alejandro Colomar wrote:
> On 2026-05-18T12:20:50+0200, Jan Kara wrote:
> > On Sat 16-05-26 19:12:08, Alejandro Colomar wrote:
> > > It seems most likely that this was a typo, and that Q_XQUOTAON was
> > > meant.
> > > 
> > > Fixes: 1eeddf25 (2010-06-16; "quotactl.2: Major updates")
> > > Cc: Jan Kara <[email protected]>
> > > Cc: Petr Gajdos <[email protected]>
> > > Cc: Jan Blunck <[email protected]>
> > > Signed-off-by: Alejandro Colomar <[email protected]>
> > 
> > Right. Thanks for the fix. Feel free to add:
> 
> I have more questions about quotactl(2).  In the operations that ignore
> the 'id' argument, am I right to assume that QCMD() is unnecessary?  My
> assumption is because if there's no user or group ID to be used, it also
> doesn't make sense to specify whether we want to affect a user or a
> group.
> 
> So, for example, Q_QUOTAOFF would have the following synopsis:
> 
> 	int quotactl(Q_QUOTAOFF, const char *_Nullable special, 0, NULL);
> 
> While Q_QUOTAON would have the following one:
> 
> 	int quotactl(QCMD(Q_QUOTAON, type), const char *_Nullable special,
> 		     int fmt, caddr_t quota_path);
> 
> Is that correct?

No, QCMD() is always required. For example for Q_QUOTAOFF you still need to
tell whether you want to disable user or group quotas. And even if the type
would not matter for some quotactl, QCMD still does a mangling to the
passed arguments that is expected by the kernel (QCMD is ((cmd) <<
SUBCMDSHIFT) | ((type) & SUBCMDMASK)).

> Also, I wonder why caddr_t was used at all, instead of void*.  It seems
> to unnecessarily require a cast, which could have been avoided with
> void*.  In quotactl_fd(), since we need to use syscall(2), which is
> variadic, I'll document the correct pointer types, instead of caddr_t*.

For this I don't have a good answer. It was like that for ages... I guess
you can ask glibc guys - the kernel uses void * but glibc uses caddr_t.

								Honza
-- 
Jan Kara <[email protected]>
SUSE Labs, CR
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.