Re: PATCH: Raw device IO for 2.1.131

Alexander Kjeldaas (astor@guardian.no)
Fri, 11 Dec 1998 22:26:55 +0100


On Thu, Dec 10, 1998 at 10:33:48PM +0000, Stephen C. Tweedie wrote:
>
> The libsetattr.a libary contained here provides two functions, declared
> in /usr/include/setattr.h:
>
> extern int getattr(const char *filename);
> extern int setattr(const char *filename, int flags);
>
> These both return -1 on error. The flags mask is composed of the
> following bits:
>
> #define ATTR_FLAG_SYNCRONOUS 1 /* Syncronous write */
> #define ATTR_FLAG_NOATIME 2 /* Don't update atime */
> #define ATTR_FLAG_APPEND 4 /* Append-only file */
> #define ATTR_FLAG_IMMUTABLE 8 /* Immutable file */
> #define ATTR_FLAG_NODIRATIME 16 /* Don't update atime for directory */
> #define ATTR_FLAG_DIRECT 32 /* Force unbuffered IO */
> #define ATTR_FLAG_NODUMP 64 /* Do not dump(8) this file */
> #define ATTR_FLAG_COMPRESS 128 /* Try to compress this file */
> #define ATTR_FLAG_BTREE 256 /* Use btree format on dir */
>
> Calling these functions on a kernel without the raw patch applied will
> return -1 with errno set to ENOSYS.
>

Two questions about this API springs to mind:

o Would it be possible to use a file-descriptor instead of a path?
This isn't a problem for raw-device use, but for a generic
interface, using a file-descriptor is safe while using a file-name
has races. You can emulate the API you describe using an
file-descriptor-based API, but you can't do the opposite.

o Would it be possible to generalize this to include setting
attributes like capabilities and ACLs? This requires passing a
variable-sized structure.

astor

-- 
 Alexander Kjeldaas, Guardian Networks AS, Trondheim, Norway
 http://www.guardian.no/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/