Whamcloud - gitweb
Many files:
[tools/e2fsprogs.git] / lib / e2p / fsetflags.c
1 /*
2  * fsetflags.c          - Set a file flags on an ext2 file system
3  *
4  * Copyright (C) 1993, 1994  Remy Card <card@masi.ibp.fr>
5  *                           Laboratoire MASI, Institut Blaise Pascal
6  *                           Universite Pierre et Marie Curie (Paris VI)
7  *
8  * This file can be redistributed under the terms of the GNU Library General
9  * Public License
10  */
11
12 /*
13  * History:
14  * 93/10/30     - Creation
15  */
16
17 #include <errno.h>
18 #include <fcntl.h>
19 #include <unistd.h>
20 #include <sys/ioctl.h>
21
22 #include <linux/ext2_fs.h>
23
24 #include "e2p.h"
25
26 int fsetflags (const char * name, unsigned long flags)
27 {
28         int fd;
29         int r;
30
31         fd = open (name, O_RDONLY);
32         if (fd == -1)
33                 return -1;
34         r = ioctl (fd, EXT2_IOC_SETFLAGS, &flags);
35         close (fd);
36         return r;
37 }