Re: modify chmod (original) (raw)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
From: | Jim Meyering |
---|---|
Subject: | Re: modify chmod |
Date: | Sun, 07 Feb 2010 14:15:03 +0100 |
jeff.liu wrote:
Jim Meyering 写道: > jeff.liu wrote: > >> A tiny patch, make chmod do not touch the inode if the new file >> permission mode is same as it was before. >> > ... > >> +static bool >> +mayhavenfsacl(const char *file) >> +{ >> +# if HAVESYSVFSH && HAVESYSSTATFSH && HAVESTRUCTSTATFSFTYPE >> + struct statfs buf; >> + >> + /* If statfs fails, assume we can't use the optimization. */ >> + if (statfs (file, &buf) < 0)_ _>> > > This function should accept a file descriptor, not a file name, > and should call fstatfs, not statfs. > > Thanks for the correction. IMHO, to get a fd, then call fstatfs ranther than statfs here, is to ensure the same file object proceeding to operated on?
fts provides a file descriptor for every directory it processes, so you can use an "FTS_ENT const *ent" parameter instead. When it refers to a directory, use ent->fts_fts->fts_cwd_fd as the file descriptor. Otherwise, you will have to call statfs after all. At first, I was thinking we could avoid statfs most of the time (i.e., change device only at a directory), but with bind-mounted regular files, the device can change at any time during a traversal.
- Re: modify chmod, (continued)
* Re: modify chmod, jeff.liu, 2010/02/01- Re: modify chmod, jeff.liu, 2010/02/05
* Re: modify chmod, jeff.liu, 2010/02/05
* Re: modify chmod, jeff.liu, 2010/02/05
* Re: modify chmod, Eric Blake, 2010/02/05
* Re: modify chmod, jeff.liu, 2010/02/05
* Re: modify chmod, jeff.liu, 2010/02/06
* Re: modify chmod, jeff.liu, 2010/02/06
* Re: modify chmod, Jim Meyering, 2010/02/06
* Re: modify chmod, jeff.liu, 2010/02/07
* Re: modify chmod,Jim Meyering <=
* Re: modify chmod, jeff.liu, 2010/02/07
* Re: modify chmod, Jim Meyering, 2010/02/07
* Re: modify chmod, jeff.liu, 2010/02/08
* Re: modify chmod, jeff.liu, 2010/02/08
* Re: modify chmod, Jim Meyering, 2010/02/13
* Re: modify chmod, jeff.liu, 2010/02/21
* Re: modify chmod, Jim Meyering, 2010/02/21
* Message not available
* Re: modify chmod, Jim Meyering, 2010/02/21
* Re: modify chmod, jeff.liu, 2010/02/21 - Re: modify chmod, jeff.liu, 2010/02/05
- Re: modify chmod, jeff.liu, 2010/02/05
- Prev by Date:Re: modify chmod
- Next by Date:Re: modify chmod
- Previous by thread:Re: modify chmod
- Next by thread:Re: modify chmod
- Index(es):