Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/util-linux/freeramdisk.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 983 by niro, Fri Apr 24 18:33:46 2009 UTC revision 984 by niro, Sun May 30 11:32:42 2010 UTC
# Line 8  Line 8 
8   *   *
9   * Licensed under GPLv2, see file LICENSE in this tarball for details.   * Licensed under GPLv2, see file LICENSE in this tarball for details.
10   */   */
11    #include <sys/mount.h>
12  #include "libbb.h"  #include "libbb.h"
13    
14  /* From <linux/fd.h> */  /* From <linux/fd.h> */
15  #define FDFLUSH  _IO(2,0x4b)  #define FDFLUSH  _IO(2,0x4b)
16    
17  int freeramdisk_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;  int freeramdisk_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
18  int freeramdisk_main(int argc, char **argv)  int freeramdisk_main(int argc UNUSED_PARAM, char **argv)
19  {  {
20   int fd;   int fd;
21    
22   if (argc != 2) bb_show_usage();   fd = xopen(single_argv(argv), O_RDWR);
   
  fd = xopen(argv[1], O_RDWR);  
23    
24   // Act like freeramdisk, fdflush, or both depending on configuration.   // Act like freeramdisk, fdflush, or both depending on configuration.
25   ioctl_or_perror_and_die(fd, (ENABLE_FREERAMDISK && applet_name[1]=='r')   ioctl_or_perror_and_die(fd, (ENABLE_FREERAMDISK && applet_name[1] == 'r')
26   || !ENABLE_FDFLUSH ? BLKFLSBUF : FDFLUSH, NULL, "%s", argv[1]);   || !ENABLE_FDFLUSH ? BLKFLSBUF : FDFLUSH, NULL, "%s", argv[1]);
27    
28   if (ENABLE_FEATURE_CLEAN_UP) close(fd);   if (ENABLE_FEATURE_CLEAN_UP) close(fd);

Legend:
Removed from v.983  
changed lines
  Added in v.984