diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2009-06-30 13:09:44 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2009-06-30 13:10:45 +0100 |
commit | 0884d8bbae6d76a603ec1385ada2938f88981c5c (patch) | |
tree | 15c91a3bc58ba3537d4b52c48accf8703f3d8ffb /java | |
parent | f850e1f065fb04df7cc87a921ab3c658741cc393 (diff) | |
download | libguestfs-0884d8bbae6d76a603ec1385ada2938f88981c5c.tar.gz libguestfs-0884d8bbae6d76a603ec1385ada2938f88981c5c.tar.xz libguestfs-0884d8bbae6d76a603ec1385ada2938f88981c5c.zip |
Generated code for mknod, mkfifo, mknod_b, mknod_c, umask.
Diffstat (limited to 'java')
-rw-r--r-- | java/com/redhat/et/libguestfs/GuestFS.java | 109 | ||||
-rw-r--r-- | java/com_redhat_et_libguestfs_GuestFS.c | 105 |
2 files changed, 214 insertions, 0 deletions
diff --git a/java/com/redhat/et/libguestfs/GuestFS.java b/java/com/redhat/et/libguestfs/GuestFS.java index 1e13b3a1..3cb1c7f3 100644 --- a/java/com/redhat/et/libguestfs/GuestFS.java +++ b/java/com/redhat/et/libguestfs/GuestFS.java @@ -3941,4 +3941,113 @@ public HashMap<String,String> test0rhashtableerr () private native void _mkswap_U (long g, String uuid, String device) throws LibGuestFSException; + /** + * make block, character or FIFO devices + * <p> + * This call creates block or character special devices, or + * named pipes (FIFOs). + * <p> + * The "mode" parameter should be the mode, using the + * standard constants. "devmajor" and "devminor" are the + * device major and minor numbers, only used when creating + * block and character special devices. + * <p> + * @throws LibGuestFSException + */ + public void mknod (int mode, int devmajor, int devminor, String path) + throws LibGuestFSException + { + if (g == 0) + throw new LibGuestFSException ("mknod: handle is closed"); + _mknod (g, mode, devmajor, devminor, path); + } + private native void _mknod (long g, int mode, int devmajor, int devminor, String path) + throws LibGuestFSException; + + /** + * make FIFO (named pipe) + * <p> + * This call creates a FIFO (named pipe) called "path" with + * mode "mode". It is just a convenient wrapper around + * "g.mknod". + * <p> + * @throws LibGuestFSException + */ + public void mkfifo (int mode, String path) + throws LibGuestFSException + { + if (g == 0) + throw new LibGuestFSException ("mkfifo: handle is closed"); + _mkfifo (g, mode, path); + } + private native void _mkfifo (long g, int mode, String path) + throws LibGuestFSException; + + /** + * make block device node + * <p> + * This call creates a block device node called "path" with + * mode "mode" and device major/minor "devmajor" and + * "devminor". It is just a convenient wrapper around + * "g.mknod". + * <p> + * @throws LibGuestFSException + */ + public void mknod_b (int mode, int devmajor, int devminor, String path) + throws LibGuestFSException + { + if (g == 0) + throw new LibGuestFSException ("mknod_b: handle is closed"); + _mknod_b (g, mode, devmajor, devminor, path); + } + private native void _mknod_b (long g, int mode, int devmajor, int devminor, String path) + throws LibGuestFSException; + + /** + * make char device node + * <p> + * This call creates a char device node called "path" with + * mode "mode" and device major/minor "devmajor" and + * "devminor". It is just a convenient wrapper around + * "g.mknod". + * <p> + * @throws LibGuestFSException + */ + public void mknod_c (int mode, int devmajor, int devminor, String path) + throws LibGuestFSException + { + if (g == 0) + throw new LibGuestFSException ("mknod_c: handle is closed"); + _mknod_c (g, mode, devmajor, devminor, path); + } + private native void _mknod_c (long g, int mode, int devmajor, int devminor, String path) + throws LibGuestFSException; + + /** + * set file mode creation mask (umask) + * <p> + * This function sets the mask used for creating new files + * and device nodes to "mask & 0777". + * <p> + * Typical umask values would be 022 which creates new + * files with permissions like "-rw-r--r--" or + * "-rwxr-xr-x", and 002 which creates new files with + * permissions like "-rw-rw-r--" or "-rwxrwxr-x". + * <p> + * See also umask(2), "g.mknod", "g.mkdir". + * <p> + * This call returns the previous umask. + * <p> + * @throws LibGuestFSException + */ + public int umask (int mask) + throws LibGuestFSException + { + if (g == 0) + throw new LibGuestFSException ("umask: handle is closed"); + return _umask (g, mask); + } + private native int _umask (long g, int mask) + throws LibGuestFSException; + } diff --git a/java/com_redhat_et_libguestfs_GuestFS.c b/java/com_redhat_et_libguestfs_GuestFS.c index df161025..91095a48 100644 --- a/java/com_redhat_et_libguestfs_GuestFS.c +++ b/java/com_redhat_et_libguestfs_GuestFS.c @@ -4530,3 +4530,108 @@ Java_com_redhat_et_libguestfs_GuestFS__1mkswap_1U } } +JNIEXPORT void JNICALL +Java_com_redhat_et_libguestfs_GuestFS__1mknod + (JNIEnv *env, jobject obj, jlong jg, jint jmode, jint jdevmajor, jint jdevminor, jstring jpath) +{ + guestfs_h *g = (guestfs_h *) (long) jg; + int r; + int mode; + int devmajor; + int devminor; + const char *path; + + mode = jmode; + devmajor = jdevmajor; + devminor = jdevminor; + path = (*env)->GetStringUTFChars (env, jpath, NULL); + r = guestfs_mknod (g, mode, devmajor, devminor, path); + (*env)->ReleaseStringUTFChars (env, jpath, path); + if (r == -1) { + throw_exception (env, guestfs_last_error (g)); + return ; + } +} + +JNIEXPORT void JNICALL +Java_com_redhat_et_libguestfs_GuestFS__1mkfifo + (JNIEnv *env, jobject obj, jlong jg, jint jmode, jstring jpath) +{ + guestfs_h *g = (guestfs_h *) (long) jg; + int r; + int mode; + const char *path; + + mode = jmode; + path = (*env)->GetStringUTFChars (env, jpath, NULL); + r = guestfs_mkfifo (g, mode, path); + (*env)->ReleaseStringUTFChars (env, jpath, path); + if (r == -1) { + throw_exception (env, guestfs_last_error (g)); + return ; + } +} + +JNIEXPORT void JNICALL +Java_com_redhat_et_libguestfs_GuestFS__1mknod_1b + (JNIEnv *env, jobject obj, jlong jg, jint jmode, jint jdevmajor, jint jdevminor, jstring jpath) +{ + guestfs_h *g = (guestfs_h *) (long) jg; + int r; + int mode; + int devmajor; + int devminor; + const char *path; + + mode = jmode; + devmajor = jdevmajor; + devminor = jdevminor; + path = (*env)->GetStringUTFChars (env, jpath, NULL); + r = guestfs_mknod_b (g, mode, devmajor, devminor, path); + (*env)->ReleaseStringUTFChars (env, jpath, path); + if (r == -1) { + throw_exception (env, guestfs_last_error (g)); + return ; + } +} + +JNIEXPORT void JNICALL +Java_com_redhat_et_libguestfs_GuestFS__1mknod_1c + (JNIEnv *env, jobject obj, jlong jg, jint jmode, jint jdevmajor, jint jdevminor, jstring jpath) +{ + guestfs_h *g = (guestfs_h *) (long) jg; + int r; + int mode; + int devmajor; + int devminor; + const char *path; + + mode = jmode; + devmajor = jdevmajor; + devminor = jdevminor; + path = (*env)->GetStringUTFChars (env, jpath, NULL); + r = guestfs_mknod_c (g, mode, devmajor, devminor, path); + (*env)->ReleaseStringUTFChars (env, jpath, path); + if (r == -1) { + throw_exception (env, guestfs_last_error (g)); + return ; + } +} + +JNIEXPORT jint JNICALL +Java_com_redhat_et_libguestfs_GuestFS__1umask + (JNIEnv *env, jobject obj, jlong jg, jint jmask) +{ + guestfs_h *g = (guestfs_h *) (long) jg; + int r; + int mask; + + mask = jmask; + r = guestfs_umask (g, mask); + if (r == -1) { + throw_exception (env, guestfs_last_error (g)); + return 0; + } + return (jint) r; +} + |