mountd: move code to a git repo
Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 46935
This commit is contained in:
parent
0dbced8a48
commit
bef03edb7a
8 changed files with 14 additions and 190 deletions
|
@ -4,17 +4,23 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mountd
|
||||
PKG_VERSION:=0.1
|
||||
PKG_RELEASE:=6
|
||||
PKG_VERSION:=2015-08-19
|
||||
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://git.openwrt.org/project/mountd.git
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=d5926d3848b1e9c6147f0bd908a35d20cdef50b5
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
|
||||
PKG_MD5SUM:=b77253ee4321d24d200fffc4f7ca3d15
|
||||
PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
|
||||
PKG_CHECK_FORMAT_SECURITY:=0
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/mountd
|
||||
SECTION:=utils
|
||||
|
@ -32,13 +38,6 @@ define Package/mountd/conffiles
|
|||
/etc/config/mountd
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -I$(PKG_BUILD_DIR)" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Package/mountd/install
|
||||
$(INSTALL_DIR) $(1)/sbin/ $(1)/etc/config/ $(1)/etc/init.d/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/mountd $(1)/sbin/
|
||||
|
|
|
@ -10,6 +10,9 @@ MOUNTD_BIN=/sbin/mountd
|
|||
|
||||
start()
|
||||
{
|
||||
P="$(uci get mountd.mountd.path)"
|
||||
[ -n "$P" -a ! -f "$P" ] && mkdir -p $P
|
||||
|
||||
service_start $MOUNTD_BIN -f
|
||||
}
|
||||
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
---
|
||||
lib/uci.c | 2 +-
|
||||
lib/ucix.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/lib/uci.c
|
||||
+++ b/lib/uci.c
|
||||
@@ -28,7 +28,7 @@ struct uci_package *p = NULL;
|
||||
struct uci_context* uci_init(char *config_file)
|
||||
{
|
||||
struct uci_context *ctx = uci_alloc_context();
|
||||
- uci_add_history_path(ctx, "/var/state");
|
||||
+ uci_add_delta_path(ctx, "/var/state");
|
||||
if(uci_load(ctx, config_file, &p) != UCI_OK)
|
||||
{
|
||||
log_printf("/etc/config/%s is missing or corrupt\n", config_file);
|
||||
--- a/lib/ucix.c
|
||||
+++ b/lib/ucix.c
|
||||
@@ -18,7 +18,7 @@ static inline int ucix_get_ptr(struct uc
|
||||
struct uci_context* ucix_init(const char *config_file)
|
||||
{
|
||||
struct uci_context *ctx = uci_alloc_context();
|
||||
- uci_add_history_path(ctx, "/var/state");
|
||||
+ uci_add_delta_path(ctx, "/var/state");
|
||||
if(uci_load(ctx, config_file, NULL) != UCI_OK)
|
||||
{
|
||||
printf("%s/%s is missing or corrupt\n", ctx->savedir, config_file);
|
|
@ -1,32 +0,0 @@
|
|||
--- a/lib/autofs.c
|
||||
+++ b/lib/autofs.c
|
||||
@@ -140,6 +140,7 @@ static int fullread(void *ptr, size_t le
|
||||
|
||||
static int autofs_in(union autofs_v5_packet_union *pkt)
|
||||
{
|
||||
+ int res;
|
||||
struct pollfd fds[1];
|
||||
|
||||
fds[0].fd = fdout;
|
||||
@@ -147,15 +148,19 @@ static int autofs_in(union autofs_v5_pac
|
||||
|
||||
while(1)
|
||||
{
|
||||
- if(poll(fds, 2, 1000) == -1)
|
||||
+ res = poll(fds, 1, -1);
|
||||
+
|
||||
+ if (res == -1)
|
||||
{
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
log_printf("failed while trying to read packet from kernel\n");
|
||||
return -1;
|
||||
}
|
||||
- if(fds[0].revents & POLLIN)
|
||||
+ else if ((res > 0) && (fds[0].revents & POLLIN))
|
||||
+ {
|
||||
return fullread(pkt, sizeof(*pkt));
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
diff -ruN mountd-0.1.orig/include/fs.h mountd-0.1/include/fs.h
|
||||
--- mountd-0.1.orig/include/fs.h 2009-10-02 22:57:04.000000000 +0200
|
||||
+++ mountd-0.1/include/fs.h 2012-07-08 18:42:32.000000000 +0200
|
||||
@@ -7,5 +7,6 @@
|
||||
#define EFI 7
|
||||
#define NTFS 8
|
||||
#define EXTENDED 9
|
||||
+#define EXT4 10
|
||||
|
||||
int detect_fs(char *device);
|
||||
diff -ruN mountd-0.1.orig/lib/fs.c mountd-0.1/lib/fs.c
|
||||
--- mountd-0.1.orig/lib/fs.c 2009-10-02 23:26:22.000000000 +0200
|
||||
+++ mountd-0.1/lib/fs.c 2012-07-08 19:28:08.000000000 +0200
|
||||
@@ -91,9 +91,14 @@
|
||||
goto out;
|
||||
if(get_le_short(buffer + 56) == 0xEF53)
|
||||
{
|
||||
- if((get_le_long(buffer + 96) & 0x0008)
|
||||
- || (get_le_long(buffer + 92) & 0x0004))
|
||||
- ret = EXT3;
|
||||
+ if(get_le_long(buffer + 92) & 0x0004)
|
||||
+ {
|
||||
+ if ((get_le_long(buffer + 96) < 0x0000040)
|
||||
+ && (get_le_long(buffer + 100) < 0x0000008))
|
||||
+ ret = EXT3;
|
||||
+ else
|
||||
+ ret = EXT4;
|
||||
+ }
|
||||
else
|
||||
ret = EXT2;
|
||||
}
|
||||
diff -ruN mountd-0.1.orig/lib/mount.c mountd-0.1/lib/mount.c
|
||||
--- mountd-0.1.orig/lib/mount.c 2009-10-03 12:54:57.000000000 +0200
|
||||
+++ mountd-0.1/lib/mount.c 2012-07-08 19:04:29.000000000 +0200
|
||||
@@ -53,7 +53,10 @@
|
||||
"EXT3",
|
||||
"FAT",
|
||||
"HFSPLUS",
|
||||
- "NTFS"
|
||||
+ "",
|
||||
+ "NTFS",
|
||||
+ "",
|
||||
+ "EXT4"
|
||||
};
|
||||
|
||||
#define MAX_MOUNTED 32
|
||||
@@ -93,7 +96,7 @@
|
||||
ucix_add_option(ctx, mountd, q->serial, "rev", q->rev);
|
||||
snprintf(t, 64, "size%d", atoi(&q->dev[3]));
|
||||
ucix_add_option(ctx, mountd, q->serial, t, q->size);
|
||||
- if(q->fs > MBR && q->fs <= NTFS)
|
||||
+ if(q->fs > MBR && q->fs <= EXT4)
|
||||
{
|
||||
snprintf(t, 64, "fs%d", atoi(&q->dev[3]));
|
||||
ucix_add_option(ctx, mountd, q->serial, t, fs_names[q->fs]);
|
||||
@@ -131,7 +134,7 @@
|
||||
{
|
||||
struct mount *mount;
|
||||
char tmp[64], tmp2[64];
|
||||
- if(fs <= MBR || fs > NTFS)
|
||||
+ if(fs <= MBR || fs > EXT4)
|
||||
return;
|
||||
mount = malloc(sizeof(struct mount));
|
||||
INIT_LIST_HEAD(&mount->list);
|
||||
@@ -147,7 +150,7 @@
|
||||
mount->mounted = 0;
|
||||
mount->fs = fs;
|
||||
list_add(&mount->list, &mounts);
|
||||
- if((!mount->ignore) && (mount->fs > MBR) && (mount->fs <= NTFS))
|
||||
+ if((!mount->ignore) && (mount->fs > MBR) && (mount->fs <= EXT4))
|
||||
{
|
||||
log_printf("new mount : %s -> %s (%s)\n", name, dev, fs_names[mount->fs]);
|
||||
snprintf(tmp, 64, "%s%s", uci_path, name);
|
||||
@@ -226,6 +229,11 @@
|
||||
log_printf("mount -t vfat -o rw,uid=1000,gid=1000 /dev/%s %s", mount->dev, tmp);
|
||||
ret = system_printf("mount -t vfat -o rw,uid=1000,gid=1000 /dev/%s %s", mount->dev, tmp);
|
||||
}
|
||||
+ if(mount->fs == EXT4)
|
||||
+ {
|
||||
+ log_printf("mount -t ext4 -o rw,defaults /dev/%s %s", mount->dev, tmp);
|
||||
+ ret = system_printf("mount -t ext4 -o rw,defaults /dev/%s %s", mount->dev, tmp);
|
||||
+ }
|
||||
if(mount->fs == EXT3)
|
||||
{
|
||||
log_printf("mount -t ext3 -o rw,defaults /dev/%s %s", mount->dev, tmp);
|
|
@ -1,13 +0,0 @@
|
|||
--- a/main.c
|
||||
+++ b/main.c
|
||||
@@ -13,7 +13,9 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
- daemon(0,0);
|
||||
+ if ((argc < 2) || strcmp(argv[1], "-f"))
|
||||
+ daemon(0,0);
|
||||
+
|
||||
daemonize = 1;
|
||||
log_start();
|
||||
log_printf("Starting OpenWrt (auto)mountd V1\n");
|
|
@ -1,10 +0,0 @@
|
|||
--- a/lib/fs.c
|
||||
+++ b/lib/fs.c
|
||||
@@ -2,7 +2,6 @@
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
-#include <error.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
|
@ -1,11 +0,0 @@
|
|||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -2,7 +2,7 @@ PROG=mountd
|
||||
OBJS=main.o lib/log.o lib/sys.o lib/autofs.o lib/mount.o lib/timer.o lib/signal.o lib/ucix.o lib/led.o lib/fs.o lib/ucix.o
|
||||
|
||||
LDFLAGS?=
|
||||
-LDFLAGS+=-ldl -luci
|
||||
+LDFLAGS+=-ldl -luci -lubox
|
||||
|
||||
CFLAGS?=
|
||||
CFLAGS+= -Wall
|
Loading…
Reference in a new issue