Changes by: flatcap
Update of /cvsroot/linux-ntfs/dynamic-disk/test
In directory usw-pr-cvs1:/tmp/cvs-serv23370
Modified Files:
Makefile.in drive.c
Added Files:
reread.c
Log Message:
util to force the kernel to reread a partition
--- NEW FILE ---
/*
* $Id: reread.c,v 1.1 2001/06/19 02:40:50 flatcap Exp $
*
* reread - Part of the Linux-NTFS project.
*
* Copyright (C) 2001 Richard Russon <nt...@fl...>
*
* Documentation is available at http://linux-ntfs.sourceforge.net/ldm
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program (in the main directory of the Linux-NTFS source
* in the file COPYING); if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/fs.h>
int main (int argc, char *argv[])
{
int ret = 1;
int fd = 0;
if (argc != 2)
{
printf ("ReRead: Force the kernel to reread the partition table on a given device.");
printf ("Usage:\n\t%s device\n", argv[0]);
goto end;
}
fd = open (argv[1], O_RDONLY);
if (fd < 0)
{
printf("open failed (%d: %s)\n", errno, strerror(errno));
goto end;
}
if ((ioctl(fd, BLKRRPART)) < 0)
{
printf("ioctl failed (%d: %s)\n", errno, strerror(errno));
goto close;
}
printf ("succeeded\n");
ret = 0;
close:
close (fd);
end:
return 0;
}
Index: Makefile.in
===================================================================
RCS file: /cvsroot/linux-ntfs/dynamic-disk/test/Makefile.in,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -U2 -r1.1.1.1 -r1.2
--- Makefile.in 2001/06/16 20:29:39 1.1.1.1
+++ Makefile.in 2001/06/19 02:40:50 1.2
@@ -1,9 +1,9 @@
# Copyright (C) 2001 Richard Russon
-SRC = drive.c
-OBJ = drive.o
+SRC = drive.c reread.c
+OBJ = drive.o reread.o
DEP = ../partitions.o
-OUT = drive
+OUT = drive reread
CC = gcc
@@ -26,5 +26,5 @@
CFLAGS += -D_FILE_OFFSET_BITS=64
-all: $(DEP) $(SRC) $(OUT) ../$(OUT)
+all: $(DEP) $(SRC) $(OUT)
.c.o:
@@ -34,9 +34,6 @@
$(CC) -o $(OUT) $(DEP) $(OBJ)
-../$(OUT): $(OUT)
- $(CP) $(OUT) ..
-
clean:
- $(RM) $(OUT) $(OBJ) ../$(OUT)
+ $(RM) $(OUT) $(OBJ)
distclean: clean
Index: drive.c
===================================================================
RCS file: /cvsroot/linux-ntfs/dynamic-disk/test/drive.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -U2 -r1.3 -r1.4
--- drive.c 2001/06/18 03:13:24 1.3
+++ drive.c 2001/06/19 02:40:50 1.4
@@ -2,5 +2,5 @@
* $Id$
*
- * ldm - Part of the Linux-NTFS project.
+ * drive - Part of the Linux-NTFS project.
*
* Copyright (C) 2001 Richard Russon <nt...@fl...>
|