Logo Search packages:      
Sourcecode: libgphoto2 version File versions

gphoto2-filesys.c File Reference


Detailed Description

Author:
Copyright 2000 Scott Fritzinger

Contributions Lutz Müller <lutz@users.sf.net> (2001)

Copyright 2009 Marcus Meissner

License
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This library 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Definition in file gphoto2-filesys.c.

#include "config.h"
#include <gphoto2/gphoto2-filesys.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <gphoto2/gphoto2-result.h>
#include <gphoto2/gphoto2-port-log.h>
#include <gphoto2/gphoto2-setting.h>
#include <limits.h>

Go to the source code of this file.

Classes

struct  _CameraFilesystem
 The internal camera filesystem structure. More...
struct  _CameraFilesystemFile
struct  _CameraFilesystemFolder

Defines

#define _(String)   (String)
#define _BSD_SOURCE
#define bindtextdomain(Domain, Directory)   (Domain)
#define CA(f, c)
#define CC(context)
#define CHECK_MEM(m)   {if (!(m)) return (GP_ERROR_NO_MEMORY);}
#define CHECK_NULL(r)   {if (!(r)) return (GP_ERROR_BAD_PARAMETERS);}
#define CL(result, list)
#define CR(result)   {int r = (result); if (r < 0) return (r);}
#define CU(result, file)
#define dcgettext(Domain, Message, Type)   (Message)
#define dgettext(Domain, Message)   (Message)
#define gettext(String)   (String)
#define GP_MODULE   "libgphoto2"
#define MIN(a, b)   (((a) < (b)) ? (a) : (b))
#define N_(String)   (String)
#define PATH_MAX   4096
#define PICTURES_TO_KEEP   2
#define textdomain(String)   (String)

Typedefs

typedef struct
_CameraFilesystemFile 
CameraFilesystemFile
typedef struct
_CameraFilesystemFolder 
CameraFilesystemFolder

Functions

static int append_file (CameraFilesystem *fs, CameraFilesystemFolder *folder, CameraFile *file, GPContext *context)
static int append_folder (CameraFilesystem *fs, const char *folder, CameraFilesystemFolder **newfolder, GPContext *context)
static int append_folder_one (CameraFilesystemFolder *folder, const char *name, CameraFilesystemFolder **newfolder)
static int append_to_folder (CameraFilesystemFolder *folder, const char *foldername, CameraFilesystemFolder **newfolder)
static int delete_all_files (CameraFilesystem *fs, CameraFilesystemFolder *folder)
static int delete_all_folders (CameraFilesystem *fs, const char *foldername, GPContext *context)
static int delete_file (CameraFilesystem *fs, CameraFilesystemFolder *folder, CameraFilesystemFile *file)
static int delete_folder (CameraFilesystem *fs, CameraFilesystemFolder **folder)
int gp_filesystem_append (CameraFilesystem *fs, const char *folder, const char *filename, GPContext *context)
 Append a file to a folder in a filesystem.
int gp_filesystem_count (CameraFilesystem *fs, const char *folder, GPContext *context)
 Count files a folder of a filesystem.
int gp_filesystem_delete_all (CameraFilesystem *fs, const char *folder, GPContext *context)
 Delete all files in specified folder.
static int gp_filesystem_delete_all_one_by_one (CameraFilesystem *fs, const char *folder, GPContext *context)
int gp_filesystem_delete_file (CameraFilesystem *fs, const char *folder, const char *filename, GPContext *context)
 Delete a file from a folder.
int gp_filesystem_delete_file_noop (CameraFilesystem *fs, const char *folder, const char *filename, GPContext *context)
 Delete a virtal file from a folder in the filesystem.
int gp_filesystem_dump (CameraFilesystem *fs)
 Dump the current filesystem.
int gp_filesystem_free (CameraFilesystem *fs)
 Free filesystem struct.
int gp_filesystem_get_file (CameraFilesystem *fs, const char *folder, const char *filename, CameraFileType type, CameraFile *file, GPContext *context)
 Get file data from the filesystem.
static int gp_filesystem_get_file_impl (CameraFilesystem *fs, const char *folder, const char *filename, CameraFileType type, CameraFile *file, GPContext *context)
int gp_filesystem_get_folder (CameraFilesystem *fs, const char *filename, const char **folder, GPContext *context)
 Search a folder that contains a given filename.
int gp_filesystem_get_info (CameraFilesystem *fs, const char *folder, const char *filename, CameraFileInfo *info, GPContext *context)
 Get information about the specified file.
int gp_filesystem_get_storageinfo (CameraFilesystem *fs, CameraStorageInformation **storageinfo, int *nrofstorageinfos, GPContext *context)
 Get the storage information about this filesystem.
int gp_filesystem_list_files (CameraFilesystem *fs, const char *folder, CameraList *list, GPContext *context)
 Get the list of files in a folder.
int gp_filesystem_list_folders (CameraFilesystem *fs, const char *folder, CameraList *list, GPContext *context)
 List all subfolders within a filesystem folder.
static int gp_filesystem_lru_check (CameraFilesystem *fs)
static int gp_filesystem_lru_clear (CameraFilesystem *fs)
static int gp_filesystem_lru_count (CameraFilesystem *fs)
static int gp_filesystem_lru_free (CameraFilesystem *fs)
static int gp_filesystem_lru_remove_one (CameraFilesystem *fs, CameraFilesystemFile *item)
static int gp_filesystem_lru_update (CameraFilesystem *fs, const char *folder, CameraFile *file, GPContext *context)
int gp_filesystem_make_dir (CameraFilesystem *fs, const char *folder, const char *name, GPContext *context)
 Create a subfolder within a folder.
int gp_filesystem_name (CameraFilesystem *fs, const char *folder, int filenumber, const char **filename, GPContext *context)
 Lookup the filename of an indexed file within a folder.
int gp_filesystem_new (CameraFilesystem **fs)
 Create a new filesystem struct.
int gp_filesystem_number (CameraFilesystem *fs, const char *folder, const char *filename, GPContext *context)
 Get the index of a file in specified folder.
int gp_filesystem_put_file (CameraFilesystem *fs, const char *folder, CameraFile *file, GPContext *context)
 Upload a file to a folder on the device filesystem.
int gp_filesystem_remove_dir (CameraFilesystem *fs, const char *folder, const char *name, GPContext *context)
 Remove a subfolder from within a folder.
int gp_filesystem_reset (CameraFilesystem *fs)
 Clear the filesystem.
static int gp_filesystem_scan (CameraFilesystem *fs, const char *folder, const char *filename, GPContext *context)
int gp_filesystem_set_file_funcs (CameraFilesystem *fs, CameraFilesystemGetFileFunc get_file_func, CameraFilesystemDeleteFileFunc del_file_func, void *data)
 Set camera filesystem file related functions.
int gp_filesystem_set_file_noop (CameraFilesystem *fs, const char *folder, CameraFile *file, GPContext *context)
 Attach file content to a specified file.
int gp_filesystem_set_folder_funcs (CameraFilesystem *fs, CameraFilesystemPutFileFunc put_file_func, CameraFilesystemDeleteAllFunc delete_all_func, CameraFilesystemDirFunc make_dir_func, CameraFilesystemDirFunc remove_dir_func, void *data)
 Set folder related functions of the filesystem.
int gp_filesystem_set_funcs (CameraFilesystem *fs, CameraFilesystemFuncs *funcs, void *data)
 Set all filesystem related function pointers.
int gp_filesystem_set_info (CameraFilesystem *fs, const char *folder, const char *filename, CameraFileInfo info, GPContext *context)
 Set information about a file.
int gp_filesystem_set_info_funcs (CameraFilesystem *fs, CameraFilesystemGetInfoFunc get_info_func, CameraFilesystemSetInfoFunc set_info_func, void *data)
 Set file information functions.
int gp_filesystem_set_info_noop (CameraFilesystem *fs, const char *folder, CameraFileInfo info, GPContext *context)
 Store the file information in the virtual fs.
int gp_filesystem_set_list_funcs (CameraFilesystem *fs, CameraFilesystemListFunc file_list_func, CameraFilesystemListFunc folder_list_func, void *data)
 Set the functions to list folders and files.
static CameraFilesystemFolder * lookup_folder (CameraFilesystem *fs, CameraFilesystemFolder *folder, const char *foldername, GPContext *context)
static int lookup_folder_file (CameraFilesystem *fs, const char *folder, const char *filename, CameraFilesystemFolder **xfolder, CameraFilesystemFile **xfile, GPContext *context)
static int recurse_delete_folder (CameraFilesystem *fs, CameraFilesystemFolder *folder)
static int recursive_folder_scan (CameraFilesystemFolder *folder, const char *lookforfile, char **foldername)
static void recursive_fs_dump (CameraFilesystemFolder *folder, int depth)

Variables

static int pictures_to_keep = -1


Generated by  Doxygen 1.6.0   Back to index