• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/samba-3.0.25b/source/include/
1/*
2   Samba share mode database library.
3
4   Copyright (C) Jeremy Allison 2005.
5
6   This library is free software; you can redistribute it and/or
7   modify it under the terms of the GNU Lesser General Public
8   License as published by the Free Software Foundation; either
9   version 2 of the License, or (at your option) any later version.
10
11   This library is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   Lesser General Public License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with this library; if not, write to the Free Software
18   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19*/
20
21#ifndef _SMB_SHARE_MODES_H_
22#define _SMB_STATE_MODES_H_
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28#if HAVE_INTTYPES_H
29# include <inttypes.h>
30#else
31# if HAVE_STDINT_H
32#  include <stdint.h>
33# endif
34#endif
35
36/* Opaque database context handle. */
37struct smbdb_ctx;
38
39/* Share mode entry. */
40/*
41 We use 64 bit types for device and inode as
42 we don't know what size mode Samba has been
43 compiled in - dev/ino may be 32, may be 64
44 bits. This interface copes with either.
45*/
46
47struct smb_share_mode_entry {
48	uint64_t dev;
49	uint64_t ino;
50	uint32_t share_access;
51	uint32_t access_mask;
52	struct timeval open_time;
53	uint32_t file_id;
54	struct process_id pid;
55};
56
57/*
58 * open/close sharemode database.
59 */
60
61struct smbdb_ctx *smb_share_mode_db_open(const char *db_path);
62int smb_share_mode_db_close(struct smbdb_ctx *db_ctx);
63
64/*
65 * lock/unlock entry in sharemode database.
66 */
67
68int smb_lock_share_mode_entry(struct smbdb_ctx *db_ctx,
69				uint64_t dev,
70				uint64_t ino);
71
72int smb_unlock_share_mode_entry(struct smbdb_ctx *db_ctx,
73				uint64_t dev,
74				uint64_t ino);
75
76/*
77 * Share mode database accessor functions.
78 */
79
80int smb_get_share_mode_entries(struct smbdb_ctx *db_ctx,
81				uint64_t dev,
82				uint64_t ino,
83				struct smb_share_mode_entry **pp_list,
84				unsigned char *p_delete_on_close);
85
86int smb_create_share_mode_entry(struct smbdb_ctx *db_ctx,
87				uint64_t dev,
88				uint64_t ino,
89				const struct smb_share_mode_entry *set_entry,
90				const char *path);
91
92int smb_delete_share_mode_entry(struct smbdb_ctx *db_ctx,
93				uint64_t dev,
94				uint64_t ino,
95				const struct smb_share_mode_entry *set_entry);
96
97int smb_change_share_mode_entry(struct smbdb_ctx *db_ctx,
98				uint64_t dev,
99				uint64_t ino,
100				const struct smb_share_mode_entry *set_entry,
101				const struct smb_share_mode_entry *new_entry);
102
103#ifdef __cplusplus
104}
105#endif
106#endif
107